From f393f70ee23a807d0a4f8c65f0df1407fe87b331 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 20 Apr 2023 19:07:08 +0200 Subject: [PATCH] listbase: Don't warn on scroll in empty list Empty lists can still be scrolled if the scroll happens in the same frame as the emptying of the list. Related: #5763 --- gtk/gtklistbase.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index 0c7df53aa0..0a7dbb0b02 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -214,6 +214,11 @@ gtk_list_base_adjustment_value_changed_cb (GtkAdjustment *adjustment, &pos, &cell_area)) { + /* If we get here with n-items == 0, then somebody cleared the list but + * GC hasn't run. So no item to be found. */ + if (gtk_list_base_get_n_items (self) == 0) + return; + g_warning ("%s failed to scroll to given position. Ignoring...", G_OBJECT_TYPE_NAME (self)); return; } -- 2.30.2